package com.ruyuan.payment.system.controller;

import com.ruyuan.payment.server.context.LoginMemberContext;
import com.ruyuan.payment.server.resp.AccountQueryResp;
import com.ruyuan.payment.server.resp.CommonResp;
import com.ruyuan.payment.server.service.AccountService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/account")
public class AccountController {

    private static final Logger LOG = LoggerFactory.getLogger(AccountController.class);

    @Resource
    private AccountService accountService;

    @GetMapping("/query-one")
    public CommonResp queryOne() {
        Long memberId = LoginMemberContext.getId();
        AccountQueryResp accountQueryResp = accountService.queryOne(memberId);
        CommonResp<AccountQueryResp> commonResp = new CommonResp<>();
        commonResp.setContent(accountQueryResp);
        return commonResp;
    }

}
